package com.changgou.order.listener;

import com.changgou.goods.feign.SkuFeign;
import com.changgou.order.service.OrderService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author LQQ
 * @Date 2020/3/16 16:45
 * @Version 1.0
 */
@Component
public class OrderTimeOutListener {
    @Autowired
    private OrderService orderService;
    @Autowired
    private SkuFeign skuFeign;

    //订单支付延迟消息.关闭订单
    @RabbitListener(queues = ("queue.ordertimeout"))
    public void receiveCloseOrderMessage(String message) {

        System.out.println("接收到关闭订单的消息=" + message);

        try {
            //关闭订单
            orderService.closeOrder(message);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
